﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GomokuCore
{
    public struct Position
    {
        public int Row;
        public int Col;

        public static Position Null = new Position(-1, -1);

        public Position(int row, int col)
        {
            Row = row;
            Col = col;
        }

        public Position Offset(int rowOffset, int colOffset)
        {
            if (Row + rowOffset < 0 || 
                Col + colOffset < 0 || 
                Row + rowOffset >= Game.BoardSize || 
                Col + colOffset >= Game.BoardSize)
                return Null;

            return new Position(Row + rowOffset, Col + colOffset);
        }

        public override bool Equals(object obj)
        {
            return base.Equals(obj);
        }

        public static bool operator ==(Position pos1, Position pos2)
        {
            return pos1.Row == pos2.Row && pos1.Col == pos2.Col;
        }

        public static bool operator !=(Position pos1, Position pos2)
        {
            return pos1.Row != pos2.Row || pos1.Col != pos2.Col;
        }
    }
}
